{layout name="../common/master"/}
<div id="right">
       <h4 style="border-bottom: 1px solid #ccc;padding-bottom: 3px">高信用列表1 (高信用Crif分（大于等于650分）并且SMS≤10条)  <span style="font-size: 16px"> 总计：{$totalCount}</span> </h4>
    <form action="" method="get" role="form">
        <!--<div class="form-group">-->
            <!--<input type="text" style="width: 200px;float: left;margin-right: 20px" {if condition="isset($_GET['userPhone'])"} value="{$_GET['userPhone']}" {/if}  name="userPhone" id="" placeholder="用户电话">-->

            <!--<label for="">短信审核状态：</label>-->
            <!--<select name="sms_status" >-->
                <!--<option {if condition="(isset($_GET['sms_status'])) AND ($_GET['sms_status'] eq 11)"} selected {/if} value="11" >全部</option>-->
                <!--<option {if condition="(isset($_GET['sms_status'])) AND ($_GET['sms_status'] eq 0)"} selected {/if} value="0">未查看</option>-->
                <!--<option {if condition="(isset($_GET['sms_status'])) AND ($_GET['sms_status'] eq 1)"} selected {/if} value="1">审核通过</option>-->
                <!--<option {if condition="(isset($_GET['sms_status'])) AND ($_GET['sms_status'] eq 2)"} selected {/if} value="2">审核不通过</option>-->
                <!--<option {if condition="(isset($_GET['sms_status'])) AND ($_GET['sms_status'] eq 3)"} selected {/if} value="3">无短信</option>-->
            <!--</select>-->
        <!--</div>-->
        <!--<button type="submit" class="btn btn-primary">查询</button>-->
    </form>
    <!--<button id="extend" type="submit" class="btn btn-info">导出到EXCEL</button>-->
    <table class="table-bordered table  table-hover" style="margin-top: 20px;">
        <thead>
        <tr>
            <th>序号</th>
            <th>用户电话</th>
            <th>短信审核状态</th>
            <th>flashCash信用评分</th>
            <th>crif分</th>
            <th>总短信数量</th>
            <th>敏感短信数量</th>
            <th>年龄</th>
            <th>审核状态</th>
            <th>创建时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach name="data" item="vo" key="k"}
         {if condition="in_array($vo['user_phone_num'],$moreTwo)"}
        <tr  {if condition="in_array($vo['user_phone_num'],$loanMore)"}style="color: red;background: green" {else/} style="color: red"{/if}>
                <th>{$vo['id']}</th>
                <th>{$vo['user_phone_num']}</th>
                <th>
                    {if condition="$vo['admin_sms_status'] eq 0"}
                    未查看
                    {elseif condition="$vo['admin_sms_status'] eq 1"}
                    审核通过
                    {elseif condition="$vo['admin_sms_status'] eq 2"}
                    审核不通过
                    {elseif condition="$vo['admin_sms_status'] eq 3"}
                    无短信
                    {/if}
                </th>
                <th>{$vo['score']}</th>
                <th>{$vo['type']}</th>
        <th>
            {if condition="($vo['smsTotalCount'] <= 10)"}
            B-
            {elseif condition="($vo['smsTotalCount'] >= 11) AND ($vo['smsTotalCount'] <= 30)"/}
            B
            {elseif condition="($vo['smsTotalCount'] >= 31) AND ($vo['smsTotalCount'] <= 50)"/}
            A-
            {elseif condition="($vo['smsTotalCount'] >= 51) AND ($vo['smsTotalCount'] <= 100)"/}
            A
            {elseif condition="($vo['smsTotalCount'] >= 101)"/}
            A+
            {/if}
        </th>
        <th>{$vo['smsCerResCount']}</th>
                <th>{$vo['age']}</th>
                <th>{$vo['check_status']}</th>
                <th>{$vo['create_time']}</th>
                <th>
                    <div class="btn-group">
                        <a style="margin-left: 5px" href="{:URL('home/Check/checkinfo',['uid'=>$vo['id'],'type'=>2])}" class="btn btn-primary btn-xs">查看详情</a>
                        <button uid={$vo['id']} type="button" class="pass btn btn-success btn-xs">审核通过</button>

                        <button uid={$vo['scoreId']} type="button" class="viewSms btn btn-xs btn-info">查看敏感短信</button>
                        <button uid={$vo['id']} type="button" class="nopass btn btn-xs btn-danger">审核不通过</button>
                    </div>
                </th>
            </tr>
        {else/}
        <tr  {if condition="in_array($vo['user_phone_num'],$loanMore)"}style="background: green;color:white"{/if}>
            <th>{$vo['id']}</th>
            <th>{$vo['user_phone_num']}</th>
            <th>
                {if condition="$vo['admin_sms_status'] eq 0"}
                未查看
                {elseif condition="$vo['admin_sms_status'] eq 1"}
                审核通过
                {elseif condition="$vo['admin_sms_status'] eq 2"}
                审核不通过
                {elseif condition="$vo['admin_sms_status'] eq 3"}
                无短信
                {/if}
            </th>
            <th>{$vo['score']}</th>
            <th>{$vo['type']}</th>
        <th>
            {if condition="($vo['smsTotalCount'] <= 10)"}
            B-
            {elseif condition="($vo['smsTotalCount'] >= 11) AND ($vo['smsTotalCount'] <= 30)"/}
            B
            {elseif condition="($vo['smsTotalCount'] >= 31) AND ($vo['smsTotalCount'] <= 50)"/}
            A-
            {elseif condition="($vo['smsTotalCount'] >= 51) AND ($vo['smsTotalCount'] <= 100)"/}
            A
            {elseif condition="($vo['smsTotalCount'] >= 101)"/}
            A+
            {/if}
        </th>
        <th>{$vo['smsCerResCount']}</th>
            <th>{$vo['age']}</th>
            <th>{$vo['check_status']}</th>
            <th>{:gmtToIndiaTimeByMysql($vo['create_time'])}</th>
            <th>
                <div class="btn-group">
                    <a style="margin-left: 5px" href="{:URL('home/Check/checkinfo',['uid'=>$vo['id'],'type'=>2])}" class="btn btn-primary btn-xs">查看详情</a>
                    <button uid={$vo['id']} type="button" class="pass btn btn-success btn-xs">审核通过</button>
                    <button uid={$vo['scoreId']} type="button" class="viewSms btn btn-xs btn-info">查看敏感短信</button>
                    <button uid={$vo['id']} type="button" class="nopass btn btn-xs btn-danger">审核不通过</button>
                </div>
            </th>
        </tr>
        {/if}
        {/foreach}
        </tbody>
    </table>
    {$page}


</div>
<script>
    $("#extend").click(function () {
        var url="{:URL('home/Check/checkingList',$_GET)}";
        url=url+"&extend=1";
        location.href=url;
    })

    $(".cibil").click(function () {
        var uid=$(this).attr("uid");
        var uuid=$(this).attr("uuid");
        var user_loan_id=$(this).attr("uld");
        var checkId=$(this).attr("checkId");
        $.post("{:URL('home/Check/getCriff')}",{uuid:uuid,uid:uid,user_loan_id:user_loan_id,checkId:checkId},function(res){
            if(res.code ==0){
                layer.alert(res.msg);
                location.reload();
            }else{
                layer.alert(res.msg);
                location.reload();
            }
        })
    })

    $(".pass").click(function(){
        var id=$(this).attr('uid');
        layer.open({
            title: '请填写原因'
            ,content: '<textarea id="yuan2">pass</textarea>',
            yes:function(){
                var content=$("#yuan2").val();
                var url="{:URL('home/Check/checkPass')}";
                url=url+"?type=1&id="+id+'&content='+content;
                $.get(url,function(res){
                    if(res['code'] != 0){
                        layer.alert(res.data)
                    }else{
                        layer.alert('success');
                        location.reload();
                    }
                })
            }
        });
    })

    $(".nopass").click(function(){
        var id=$(this).attr("uid");
        layer.open({
            title: '请填写原因'
            ,content:`<select name="name" id="yuan" class="form-control">
                <option value="Risk SMS">Risk SMS</option>
        <option value="No SMS">No SMS</option>
        <option value="SMS《30">SMS《30</option>
        <option value="FlashCash（Use the same phone）">FlashCash（Use the same phone）</option>
        <option value="Invalid company name">Invalid company name</option>
        <option value="Not the same person">Not the same person</option>
        <option value="Others">Others</option>
        </select>`,
        yes:function(){
            var content=$("#yuan option:selected").val();
            var url="{:URL('home/Check/checkPass')}";
            url=url+"?type=0&id="+id+'&content='+content;
            $.get(url,function(res){
                if(res['code'] != 0){
                    layer.alert(res.data);
                    location.reload();
                }else{
                    layer.alert('success');
                    location.reload();
                }
            })
        }
    });
    })


    $(".viewSms").click(function(){
        var sms=$(this).attr("uid");
        $.post("{:URL('home/Check/viewHighRiskSms')}",{id:sms},function(res){
            if(res.code==0){
                var data=res.data[0].smsCerRes;
              if(data.length !=0){
                  data=JSON.parse(data);
                  var userPhone=res.data[0].user_phone;
                  var userId=res.data[0].user_id;
                  var smsContent=`
              <table class="table table-hover table-bordered">
                          <thead>
                          <tr>
                          <th>短信内容</th>
                          <th>敏感词汇</th>
                          </tr>
                          </thead>
                          <tbody>
                              `

              for(let k in data){
                  smsContent += "<tr><td>" + data[k].sms_content+"</td><td>"+ data[k].riskkey+"</td></tr>"
              }
                  smsContent +=  `
              </tbody>
                  </table>
                  <button  type="submit" uid=`+userId+` class="btn checkPass btn-success">审核通过</button>
                          <button type="submit"  uid=`+userId+` class="btn checkNoPass btn-danger">审核不通过</button>
`
              layer.open({
                  title:'用户电话：'+userPhone,
                  type: 1,
                  area: ['1080px', '720px'],
                  content: smsContent
              });
              }else{
                  layer.alert("no sms!");
              }

            }
        })
    })

    $("body").on('click','.checkPass',function () {
        var uid=$(this).attr('uid');
        var data={
            uid:uid,
            admin_sms_status:1
        }
        $.post("{:URL('home/User/updateUser')}",data,function(res){
            if(res.code == 0){
                layer.alert('success');
                location.reload();
            }else{
                layer.alert('error')
            }
        })
    })

    $("body").on('click','.checkNoPass',function () {
        var uid=$(this).attr('uid');
        var data={
            uid:uid,
            admin_sms_status:2
        }
        $.post("{:URL('home/User/updateUser')}",data,function(res){
            if(res.code == 0){
                layer.alert('success');
                location.reload();
            }else{
                layer.alert('error')
            }
        })
    })
</script>
